//
//  NATextImageView.m
//  NewApp
//
//  Created by  on 12-6-19.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "NATextImageView.h"

@implementation NATextImageView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //Add background
        _labelBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0.f, self.frame.size.height - 20.f,
                                                                          self.frame.size.width, 20.f)];
        

        [self addSubview:_labelBackgroundView];
        
        
        //Build description label
        _descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.f, 0.f,
                                                                     self.frame.size.width, 20.f)];
        _descriptionLabel.textColor = [UIColor whiteColor];
        _descriptionLabel.font = [UIFont systemFontOfSize:12.f];
        _descriptionLabel.textAlignment = UITextAlignmentLeft;
        _descriptionLabel.backgroundColor = [UIColor clearColor];
        
        [_labelBackgroundView addSubview:_descriptionLabel];
    }
    return self;
}

- (void) dealloc {
    [_descriptionLabel release];
    [_labelBackgroundView release];
    
    [super dealloc];
}

- (void) setImageDescription:(NSString *) description {
    _descriptionLabel.text = description;
    _descriptionLabel.textColor = [UIColor whiteColor];
    _labelBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"index2_text_bg"]];
}


@end
